package info.openlvb.openface.client.base.backup;


import com.google.gwt.event.logical.shared.OpenEvent;
import com.google.gwt.event.logical.shared.OpenHandler;
import com.google.gwt.user.client.ui.DisclosurePanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class BackupFunctionsPanel extends VerticalPanel{
	
	DisclosurePanel addBackup, tasksBackup;
	TasksBackupPanel tasksBackupPanel;
	
	public BackupFunctionsPanel(){
		
		addBackup = new DisclosurePanel("Ajout d'une tâche de sauvegardes");
		addBackup.setAnimationEnabled(true);
		addBackup.setContent(new AddBackupPanel());
		
		tasksBackup = new DisclosurePanel("Liste des tâches de sauvegardes");
		tasksBackup.setAnimationEnabled(true);
		tasksBackupPanel = new TasksBackupPanel();
		tasksBackup.setContent(tasksBackupPanel);
		
		tasksBackup.addOpenHandler(new OpenHandler<DisclosurePanel>() {
			public void onOpen(OpenEvent<DisclosurePanel> event) {
				addBackup.setOpen(false);
			}
		});
		addBackup.addOpenHandler(new OpenHandler<DisclosurePanel>() {
			public void onOpen(OpenEvent<DisclosurePanel> event) {
				tasksBackup.setOpen(false);
				tasksBackupPanel.refresh();
			}
		});
		add(addBackup);
		add(tasksBackup);
	}

}
